import java.util.Scanner;

public class Demo16 {
    private volatile static int isQuit = 0;
    public static void main(String[] args) {
        // 读
        Thread t1 = new Thread(()->{
            while(isQuit == 0){
                // 循环里面什么都不做
            }

            System.out.println("t1线程结束!");
        });
        t1.start();

        // 修改isQuit的值使线程t1结束
        Thread t2 = new Thread(()->{
            System.out.println("请输入 isQuit的值:");
            Scanner scanner = new Scanner(System.in);
            isQuit = scanner.nextInt();
        });
        t2.start();
    }
}
